<style lang="scss" scoped>
li {
  height: 0.54rem;
  line-height: 0.54rem;
  &:last-child::after {
    color: fff;
    border: none;
  }
}
</style>

<template>
  <div class="user_set full bgfff">
    <ul>
      <li class="border-b padding-lr15 flex-col" @click="toRouter('login')">
        <i class="iconfont icon-qiehuanzhanghao"></i>
        <div class="box1 padding-l5">账户切换</div>
        <i class="iconfont icon-jiantou"></i>
      </li>
      <li class="border-b padding-lr15 flex-col" @click="handlePayPwd">
        <i class="iconfont icon-mima"></i>
        <div class="box1 padding-l5">支付密码</div>
        <i class="iconfont icon-jiantou"></i>
      </li>
      <li class="border-b padding-lr15 flex-col" @click="handleCard">
        <i class="iconfont icon-weibiaoti-"></i>
        <div class="box1 padding-l5">银行卡</div>
        <i class="iconfont icon-jiantou"></i>
      </li>
      <li class="border-b padding-lr15 flex-col" @click="toRouter('forget_pwd')">
        <i class="iconfont icon-mima1"></i>
        <div class="box1">修改密码</div>修改
        <i class="iconfont icon-jiantou"></i>
      </li>
      <li class="border-b padding-lr15 flex-col">
        <!-- <i class="iconfont icon-yunongtongqingchuhuancun"></i>
        <div class="box1 padding-l5">清除缓存</div>
        <span>12k</span> -->
      </li>
      <!-- <li class="border-b padding-lr15 flex-col">
        <i class="iconfont icon-shouji"></i>
        <div class="box1 padding-l5">智能屋(5.1.5)</div>
        <i class="iconfont icon-jiantou"></i>
      </li> -->
    </ul>
    <footer class="box-center footer font-14 box-center">
      <div class="cfff box-center" @click="signOut">退出登录</div>
    </footer>
  </div>
</template>

<script>
export default {
  name: "user_set",
  mounted() {
    let that = this;
    this.$nextTick(() => {});
  },
  methods: {
    //退出登录
    signOut() {
      this.alert("您确认退出吗？", 2, () => {
        localStorage.clear(); // 清除用户所有保存数据
        this.toRouter("login");
      });
    },
    // 查看是否有 银行卡，进行相应操作
    handleCard() {
      let that = this;
      this.http.get("userbankcard/info").then(res => {
        if (res.data) {
          that.toRouter("banl_card");
        } else {
          that.toRouter("add_card/" + 0);
        }
      });
    },
    // 查看是否后支付密码，进行相应操作
    handlePayPwd() {
      let that = this;
      this.http.post("user/isNotPayPassWord").then(res => {
        // console.log(JSON.stringify(res));
        if (res.code === 504) {
          // 有密码
          that.$router.push({
            path: "/forget_PayPwd"
          });
        } else {
          this.toRouter("set_pay");
        }
      });
    }
  }
};
</script>

